import Vue from 'vue'
import Router from 'vue-router'
import TopMenuBar from "@/views/menu/TopMenuBar";

Vue.use(Router)

/**
 * 挂载路由配置
 * */
export const asyncRouterMap = [
  {
    path: '/top',
    component: TopMenuBar,
    meta: {
      title: '顶部菜单测试',
      noCache: true
    },
    children:[
      {
        path: 'login',
        name: 'login',
        meta: {
          title: '登录',
          noCache: true
        },
        component: () => import('@/views/login'),
      },
    ]
  },

  {
    path: '/user',
    component: TopMenuBar,
    meta: {
      title: '用户管理',
      noCache: true
    },
    children:[
      {
        path: 'userList',
        name: 'userList',
        meta: {
          title: '用户列表',
          noCache: true
        },
        component: () => import('@/views/userManage/index'),
      },
    ]
  },
]

export const constantRouterMap = [


  // { path: '/loginDemo',
  //   meta: { title: '登录demo', noCache: true },
  //   component: () => import('@/views/loginDemo'),
  // },
  { path: '/login',
    meta: { title: '登录', noCache: true },
    component: () => import('@/views/login'),
    hidden: true
  },
  // { path: '/top',
  //   meta: { title: '顶部菜单', noCache: true },
  //   component: () => import('@/views/menu/TopMenuBar'),
  // },
  {
    path: '/404',
    component: () => import('@/views/error/404'),
    hidden: true
  }
]

const $router = new Router({
  routes: constantRouterMap
  //   [
  //   {
  //     path: '/',
  //     name: 'HelloWorld',
  //     component: HelloWorld
  //   }
  // ],
})

export default $router;
